#include <iostream>
#include <fstream>
#include <ctime>
using namespace std;

// def sort(array):
//     pass

void read_from_file(int array[], int size, string file_name) {
    ifstream fin;
    fin.open(file_name);
    
    for (int i = 0; i < size; i++) {
        fin >> array[i];
    }
}

void print_array(int array[], int size ) {
    for (int i = 0; i < size; i++) {
        cout << array[i] << " ";
    }
}

void sort(int array[], int size ) {
    for (int j = 0; j < size - 1; j++) {
        bool swap = false;
        for (int i = 0; i < size - 1 - j; i++) {
            if (array[i] > array[i+1]) {
                int temp = array[i];
                array[i] = array[i+1];
                array[i+1] = temp;
                swap = true;
            }
            
        }
        if (swap == false) {
            return;
        }
    }
}




int main() {
    
    int size = 5000;
    
    int ar[size];
    
    read_from_file(ar, size, "m1_sorted.txt");
    int t1 = clock();
    sort (ar, size);
    int t2 = clock();
    cout << "m1_sorted " << (t2 - t1)*1000 /CLOCKS_PER_SEC << " milliseconds\n";
    read_from_file(ar, size, "m2_reverse.txt");
    int t3 = clock();
    sort (ar, size);
    int t4 = clock();
    cout << "m2_reverse " << (t4 - t3)*1000 /CLOCKS_PER_SEC << " milliseconds\n";
    read_from_file(ar, size, "m3_shuffle.txt");
    int t5 = clock();
    sort (ar, size);
    int t6 = clock();
    cout << "m3_shuffle " << (t6 - t5)*1000 /CLOCKS_PER_SEC << " milliseconds\n";
    return 0;
}